package com.fhp.DAO;

import com.fhp.Bean.ExcelCarData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author liuxin
 */
@Mapper
public interface DataDao {
    /**
     * 批量插入
     * @param list 表名
     */
    @Insert({
            "<script>",
            "INSERT INTO Card_Table(CardType,UserDefine6,CarNo,UserDefine3,UserDefine7," +
                    "CardID,UserDefine9,UserDefine10,cardNO,StartUseDT,ExpireDT,CarDesc,UserDefine4,AppVerID,C_ID) VALUES",
            "<foreach collection='list' item='data' separator=','>",
            "(#{data.cardType},#{data.userDefine6},#{data.carNo},#{data.userDefine3},#{data.userDefine7}," +
                    "#{data.cardId},#{data.userDefine9},#{data.userDefine10},#{data.cardNo},#{data.startUse},#{data.endUse},#{data.carDesc}," +
                    "#{data.userDefine4},#{data.appVerId},#{data.cId})",
            "</foreach>",
            "</script>"
    })
    void save(@Param("list") List<ExcelCarData> list);
}
